#include "CustomView.h"
#include "iostream"

CustomView::CustomView(QObject *parent) :
    QGraphicsView((QGraphicsView*)parent)
{
    Pressed=false;
}


void CustomView::mousePressEvent( QMouseEvent * event )
{
    //std::cout << "Puslado:\n";
    Pressed=true;
    emit mousePress(event->x(),event->y());
}

void CustomView::mouseMoveEvent( QMouseEvent * event)
{
    if(Pressed)
    {
        //std::cout << "movido:\n";
        emit mouseMove(event->x(),event->y());
    }
}

void CustomView::mouseReleaseEvent(QMouseEvent *event)
{
    //std::cout << "Soltado:\n";
    Pressed=false;
    emit mouseRelease(event->x(),event->y());
}
